#include <iostream>
using namespace std;

/*无参构造函数想要调用有参构造函数必须使用初始化列表*/
class Person
{
public:
    Person()
    {
        cout << "父类无参构造\n";
    }

public:
    int m_age;
};
class Student : public Person
{
public:
    Student()
    {
        cout << "子类无参构造\n";
    }
#if 0
    static void printInfo()
    {
        cout << "m_no" << this->m_no << endl;
        cout << "m_room" << m_room << endl;

        /*this->,this指针能够拿到的变量static变量都不可以*/
    }
#endif
    /*static
     **static变量修饰的变量（属性）：
        1.是属于类的
        2.访问方式三种
        static修饰的函数
        1.拿不到普通函数
        2.拿不到普通变量
        在静态函数内没有this，因为this属于对象的
        
     **
     **
     *
    */
#if 1
    void printInfo()
    {
        cout << "m_no" << this->m_no << endl;
        cout << "m_room" << m_room << endl;

        /*this->,this指针能够拿到的变量static变量都不可以*/
    }
#endif
    int setNo()
    {
        this->m_no = 30;
    }

public:
    int m_no;
    static int m_room;
};

int Student::m_room = 0;

int main()
{
    /*静态变量获取方式*/
    /*case:1*/
    Student stu;
    stu.m_room = 254;

    /*case:2*/
    Student::m_room = 999;
    Student *stu1 = new Student();
    /*case:3*/
    stu1->m_room = 257;
    cout << "m_room=" << Student::m_room << endl;
}